import request from '@/config/axios'

export interface DicVO {
  id: number
  type: string
  key: string
  value: string
}

// 查询字典列表
export const getDicPage = async (params) => {
  return await request.get({ url: `/sca/dic/page`, params })
}

// 查询字典详情
export const getDic = async (id: number) => {
  return await request.get({ url: `/sca/dic/get?id=` + id })
}

// 新增字典
export const createDic = async (data: DicVO) => {
  return await request.post({ url: `/sca/dic/create`, data })
}

// 修改字典
export const updateDic = async (data: DicVO) => {
  return await request.put({ url: `/sca/dic/update`, data })
}

// 删除字典
export const deleteDic = async (id: number) => {
  return await request.delete({ url: `/sca/dic/delete?id=` + id })
}

// 导出字典 Excel
export const exportDic = async (params) => {
  return await request.download({ url: `/sca/dic/export-excel`, params })
}
